package com.hxm.appGenealogy.controller;

import com.hxm.appGenealogy.entity.*;
import com.hxm.appGenealogy.service.DynamicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 动态控制器;
 */
@CrossOrigin
@RestController
@RequestMapping("app/dynaic")
public class DynamicController {

    @Autowired
    private DynamicService dynamicService;

    /**
     * 发表动态;
     * @param dynamic
     * @return
     */
    @PostMapping("insertDynamic")
    public ResponDataVo insertAdd(@RequestBody DynamicVo dynamic) {
        return dynamicService.insertAdd(dynamic);
    }
    /**
     * 查询家族的动态;
     */
    @PostMapping("selectfamilydynamic")
    public ResponDataVo selectFamilyDynamic(@RequestBody FamilyVo family) {
        return dynamicService.selectFamilyDynamic(family);
    }
    /**
     *查询个人发表的动态的信息;
     */
    @PostMapping("selectpeopledynamic")
    public ResponDataVo selectPeopleDynamic(@RequestBody DynamicVo dynamic){
       return dynamicService.selectPeopleDynamic(dynamic);
    }
    /**
     * 传一个动态的详情信息,和回复评论;
     * @param dynamic
     * @return
     */
    @PostMapping("selectDynamicMessage")
    public ResponDataVo selectDynamicMessage(@RequestBody Dynamic dynamic){
       return dynamicService.selectDynamicMessage(dynamic);
    }
    /**
     *删除动态;
     */
    @PostMapping("delDynamic")
    public ResponDataVo delDynamic(@RequestBody Dynamic dynamic){
        return dynamicService.delDynamic(dynamic);
    }
}
